package org.example.demo.dao;

import jakarta.persistence.EntityManager;
import org.example.demo.jpaentity.OrderEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class OrderDaoHbExample {
    @Autowired
    private EntityManager entityManager;

    public OrderEntity selectById(int id) {
        return entityManager.find(OrderEntity.class, id);
    }

    public int deleteById(int id) {

        OrderEntity orderEntity = entityManager.find(OrderEntity.class, id);
        entityManager.remove(orderEntity);
        return 1;
    }
}
